/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.BaseModel;
import com.liferay.portal.model.impl.BaseModelImpl;

import slcu.service.SolicitudAltaAlumnoMailDestinoLocalServiceUtil;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.util.HashMap;
import java.util.Map;

/**
 * @author tito
 */
public class SolicitudAltaAlumnoMailDestinoClp extends BaseModelImpl<SolicitudAltaAlumnoMailDestino>
	implements SolicitudAltaAlumnoMailDestino {
	public SolicitudAltaAlumnoMailDestinoClp() {
	}

	public Class<?> getModelClass() {
		return SolicitudAltaAlumnoMailDestino.class;
	}

	public String getModelClassName() {
		return SolicitudAltaAlumnoMailDestino.class.getName();
	}

	public long getPrimaryKey() {
		return _mailDestinoId;
	}

	public void setPrimaryKey(long primaryKey) {
		setMailDestinoId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_mailDestinoId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("mailDestinoId", getMailDestinoId());
		attributes.put("nombre", getNombre());
		attributes.put("mail", getMail());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		Long mailDestinoId = (Long)attributes.get("mailDestinoId");

		if (mailDestinoId != null) {
			setMailDestinoId(mailDestinoId);
		}

		String nombre = (String)attributes.get("nombre");

		if (nombre != null) {
			setNombre(nombre);
		}

		String mail = (String)attributes.get("mail");

		if (mail != null) {
			setMail(mail);
		}
	}

	public long getMailDestinoId() {
		return _mailDestinoId;
	}

	public void setMailDestinoId(long mailDestinoId) {
		_mailDestinoId = mailDestinoId;
	}

	public String getNombre() {
		return _nombre;
	}

	public void setNombre(String nombre) {
		_nombre = nombre;
	}

	public String getMail() {
		return _mail;
	}

	public void setMail(String mail) {
		_mail = mail;
	}

	public BaseModel<?> getSolicitudAltaAlumnoMailDestinoRemoteModel() {
		return _solicitudAltaAlumnoMailDestinoRemoteModel;
	}

	public void setSolicitudAltaAlumnoMailDestinoRemoteModel(
		BaseModel<?> solicitudAltaAlumnoMailDestinoRemoteModel) {
		_solicitudAltaAlumnoMailDestinoRemoteModel = solicitudAltaAlumnoMailDestinoRemoteModel;
	}

	public void persist() throws SystemException {
		if (this.isNew()) {
			SolicitudAltaAlumnoMailDestinoLocalServiceUtil.addSolicitudAltaAlumnoMailDestino(this);
		}
		else {
			SolicitudAltaAlumnoMailDestinoLocalServiceUtil.updateSolicitudAltaAlumnoMailDestino(this);
		}
	}

	@Override
	public SolicitudAltaAlumnoMailDestino toEscapedModel() {
		return (SolicitudAltaAlumnoMailDestino)Proxy.newProxyInstance(SolicitudAltaAlumnoMailDestino.class.getClassLoader(),
			new Class[] { SolicitudAltaAlumnoMailDestino.class },
			new AutoEscapeBeanHandler(this));
	}

	@Override
	public Object clone() {
		SolicitudAltaAlumnoMailDestinoClp clone = new SolicitudAltaAlumnoMailDestinoClp();

		clone.setMailDestinoId(getMailDestinoId());
		clone.setNombre(getNombre());
		clone.setMail(getMail());

		return clone;
	}

	public int compareTo(
		SolicitudAltaAlumnoMailDestino solicitudAltaAlumnoMailDestino) {
		int value = 0;

		if (getMailDestinoId() < solicitudAltaAlumnoMailDestino.getMailDestinoId()) {
			value = -1;
		}
		else if (getMailDestinoId() > solicitudAltaAlumnoMailDestino.getMailDestinoId()) {
			value = 1;
		}
		else {
			value = 0;
		}

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		SolicitudAltaAlumnoMailDestinoClp solicitudAltaAlumnoMailDestino = null;

		try {
			solicitudAltaAlumnoMailDestino = (SolicitudAltaAlumnoMailDestinoClp)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = solicitudAltaAlumnoMailDestino.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{mailDestinoId=");
		sb.append(getMailDestinoId());
		sb.append(", nombre=");
		sb.append(getNombre());
		sb.append(", mail=");
		sb.append(getMail());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(13);

		sb.append("<model><model-name>");
		sb.append("slcu.model.SolicitudAltaAlumnoMailDestino");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>mailDestinoId</column-name><column-value><![CDATA[");
		sb.append(getMailDestinoId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>nombre</column-name><column-value><![CDATA[");
		sb.append(getNombre());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>mail</column-name><column-value><![CDATA[");
		sb.append(getMail());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _mailDestinoId;
	private String _nombre;
	private String _mail;
	private BaseModel<?> _solicitudAltaAlumnoMailDestinoRemoteModel;
}